package com.xianggu.designMode.chainMethod.demo03;

public class OrderResult {
    private boolean success;     // 处理是否成功（true：成功，false：失败）
    private String message;      // 处理结果信息（如失败原因）
    private String failedStep;   // 失败的处理环节（如"库存校验"、"支付校验"）

    // 静态工厂方法
    public static OrderResult success() {
        return new OrderResult(true, "处理成功", null);
    }
    
    public static OrderResult fail(String message, String failedStep) {
        return new OrderResult(false, message, failedStep);
    }
    
    // 构造函数、Getter省略


    public OrderResult(boolean success, String message, String failedStep) {
        this.success = success;
        this.message = message;
        this.failedStep = failedStep;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getFailedStep() {
        return failedStep;
    }

    public void setFailedStep(String failedStep) {
        this.failedStep = failedStep;
    }
}